package com.atguigu03.stream;

import org.junit.Test;

import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.List;
import java.util.stream.IntStream;
import java.util.stream.Stream;

public class StreamAPITest {
    //创建 Stream方式一：通过集合
    @Test
    public void t1(){
        List<Employee> employeeslist = EmployeeData.getEmployees();
        //顺序流
        Stream<Employee> stream1 = employeeslist.stream();
        //并行流
        Stream<Employee> stream2 = employeeslist.parallelStream();

        System.out.println(stream1);
        System.out.println(stream2);
    }
    //创建 Stream方式二：通过数组
    public void t2(){
        //调用Arrays类的static <T> Stream<T> stream(T[] array): 返回一个流
        Integer[] arr1=new Integer[]{1,2,3,4,5};
        Stream<Integer> stream1 = Arrays.stream(arr1);

        int[] arr2=new int[]{1,2,3,4,5,6};
        IntStream stream2 = Arrays.stream(arr2);
    }
}


































